#!/bin/bash

# authToken环境变量设置脚本
# 使用方法: source set-auth-token.sh 或 . set-auth-token.sh

echo "=== 设置authToken环境变量 ==="

# 设置您的authToken配置
export SHOPLUS_AUTH_NAME="13143359181"
export SHOPLUS_AUTH_EXPIRES="1757322261597"
export SHOPLUS_AUTH_ACCESS_TOKEN="Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJ7XCJhY2NvdW50TnVtYmVyXCI6XCIxMzE0MzM1OTE4MVwiLFwiYWNjb3VudFR5cGVcIjowLFwiYXBwbHlTdGF0dXNcIjoyLFwiYnVzaW5lc3NUeXBlXCI6MixcImZyb21TeXN0ZW1cIjoxMyxcImlkXCI6NTQwMTUyLFwiaXNFeHBpcmVcIjpmYWxzZSxcImp3dElkXCI6XCI5NDRjMmM2NTdhNTQ0ODJkOWRkMzRkM2Q3YmI2ZDc4OFwiLFwibG9naW5OYW1lXCI6XCIxMzE0MzM1OTE4MVwiLFwibWVyY2hhbnRJZFwiOjUzMTU0OCxcInByb2ZpbGVcIjpcImdjcF91c193ZXN0MVwiLFwic3lzdGVtSWRcIjo4LFwidG9rZW5FeHBpcmVEYXRlXCI6MTc1NzMyMjI2MTQwNyxcIndlY2hhdFN1YlwiOmZhbHNlfSIsImlzcyI6Inp6LXNhYXMtcGVyaW1zc2lvbiIsImlhdCI6MTc1NjcxNzQ2MSwianRpIjoiOTQ0YzJjNjU3YTU0NDgyZDlkZDM0ZDNkN2JiNmQ3ODgifQ.AGhNKdNQfUi7FoxHBgiL33157ls6y8zUfmk-G585rX8"
export SHOPLUS_AUTH_USER_ID="540152"
export SHOPLUS_AUTH_PHONE="13143359181"
export SHOPLUS_AUTH_LOCALE="en"

echo "✅ authToken环境变量已设置:"
echo "- 用户名: $SHOPLUS_AUTH_NAME"
echo "- 用户ID: $SHOPLUS_AUTH_USER_ID"
echo "- 手机号: $SHOPLUS_AUTH_PHONE"
echo "- 语言: $SHOPLUS_AUTH_LOCALE"
echo "- 过期时间: $(date -d @$(($SHOPLUS_AUTH_EXPIRES / 1000)) 2>/dev/null || date -r $(($SHOPLUS_AUTH_EXPIRES / 1000)) 2>/dev/null || echo '2025-07-20')"
echo ""
echo "现在可以使用简化的curl命令:"
echo "curl -X POST http://localhost:3000/api/products/complete-flow \\"
echo "  -H \"Content-Type: application/json\" \\"
echo "  -d '{\"url\": \"您的TikTok商品链接\"}'"
echo ""
echo "注意: 请使用 'source set-auth-token.sh' 或 '. set-auth-token.sh' 来运行此脚本"